'**************************************'
'  Commencing Date Validation on change'
'			FORM B ,C A& D			   '
'**************************************'

Sub CDDay(FormName)
	if LEN(FormName.txtCDDay.value) <> 2 THEN
		MSGBOX "Invalid DAY"
		
		FormName.txtCD.value=""
	Else
		THEMONTH = FormName.txtCDMonth.value
		If len(THEMONTH) = 2 Then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Msgbox "Date Invalid."
				
				FormName.txtCD.value=""
			Else
				If len(FormName.txtCDYear.value)=4 and len(FormName.txtCDDay.value)= 2 then
					NewDate = FormName.txtCDDay.value & " " &  strMM & " " & FormName.txtCDYear.value		
						If ISDATE(Newdate)=FALSE THEN
							msgbox "Date Invalid"
							
							FormName.txtCD.value=""
						Else
							FormName.txtCD.value = NewDate
						End	If
				else
					msgbox "Date Invalid"
					
					FormName.txtCD.value=""
				end If
			end If
		else			
			msgbox "Date Invalid"
			
			FormName.txtCD.value=""
		end If
	end If
End Sub

'*******************************************'
'  Commencing Full Date Validation on change'
'			FORM B ,C A& D		 			'
'*******************************************'
Function ValidateDate(sDateValue, sDateMsg, sMsgTitle )

Dim lYearNo
Dim lMonthNo
Dim lDayNo
Dim sFullDate

	ValidateDate = true
	if LEN(sDateValue) <> 8 THEN
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	lDayNo = mid(sDateValue, 7, 2)
	lMonthNo = mid(sDateValue, 5, 2)
	lYearNo = left(sDateValue, 4)
	If isnumeric(lMonthNo) = false then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Month captured must be within 1 to 12", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	If isnumeric(lDayNo) = false then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Day captured must be within 1 to 31", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	If isnumeric(lYearNo) = false then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Year captured must be greater than 1850", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	If lMonthNo < 1 or lMonthNo > 12 then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Month captured must be within 1 to 12", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	If lDayNo < 1 or lDayNo > 31 then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Day captured must be within 1 to 31", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	If lYearNo < 1850 then
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Year captured must be greater than 1850", , sMsgTitle
		ValidateDate = false
		exit function
	End if
	sFullDate = lDayNo & " " & GetMonth(lMonthNo) & " " & lYearNo
	If ISDATE(sFullDate) = FALSE THEN
		MSGBOX "Invalid " & sDateMsg & " captured - must be YYYYMMDD" & vbcrlf & "Invalid Day/Month/Year combination captured", , sMsgTitle
		ValidateDate = false
		exit function
	end if
		
End Function

Sub ADDay(FormName)
	if LEN(FormName.txtADDay.value) <> 2 THEN
		MSGBOX "Invalid DAY"
		
		FormName.txtAD.value=""
	Else
			ADMM=FormName.txtADMonth.value
			If len(ADMM) = 2 Then
				strMM = GetMonth(ADMM)
				If strMM = "NotValid" then
					Msgbox "Date Invalid."
					
					FormName.txtAD.value=""
				Else
					If len(FormName.txtADYear.value)=4 and len(FormName.txtADDay.value)= 2 then
					NewDate = FormName.txtADDay.value & " " &  strMM & " " & FormName.txtADYear.value		
						If ISDATE(Newdate)=FALSE THEN
							msgbox "Date Invalid"
							
							FormName.txtAD.value=""
						Else
							FormName.txtAD.value = NewDate
							If FormName.txtADMonth.value = 01 or FormName.txtADMonth.value = 02 then
								FormName.txtTY.value = FormName.txtADYear.value
							else
								FormName.txtTY.value = FormName.txtADYear.value + 1
							end If
						End If
					else
						msgbox "Date Invalid"
						
						FormName.txtAD.value=""
					end If
				END iF
			else
				msgbox "Date Invalid"
				
				FormName.txtAD.value=""
			end If
	end If
End Sub


Sub BDDay(FormName)

	'YearChange "frmDirective","txtBdDay","txtBDYear","txtBDMonth","txtBD"

	
	if LEN(FormName.txtBDDay.value) <> 2 THEN
		MSGBOX "Invalid DAY"
		
		FormName.txtBD.value=""
	Else
		THEMONTH = FormName.txtBDMonth.value
		If len(THEMONTH)=2 then
			strMM = GetMonth(THEMONTH)
			If strMM = "NotValid" then
				Msgbox "Date Invalid."
				
				FormName.txtBD.value=""
			Else
			NewDate =FormName.txtBDDay.value  & " " &  strMM & " " & FormName.txtBDYear.value		
			If ISDATE(Newdate)=FALSE THEN
					msgbox "Date Invalid"
					
					FormName.txtBD.value=""
				Else
				FormName.txtBD.value = NewDate
				End If
			END iF
		Else
			msgbox "Date Invalid"
			
			FormName.txtBD.value=""
		End If
	end If
End Sub

'**************************************'
'  Commencing Date Validation on change'
'			FORM B ,C A& D	           '
'				Year				   '
'**************************************'

Sub CDYear(FormName)
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid YEAR"
		
		FormName.txtCD.value = ""
	Else
		if LEN(FormName.txtCDYear.value) <> 4 OR FormName.txtCDYear.value = "0000" THEN
			MSGBOX "Invalid YEAR"
			
			FormName.txtCD.value = ""
		else
			iF IsNumeric(FormName.txtCDYear.value) = False then
			MSGBOX "Invalid YEAR"
			
		FormName.txtCD.value = ""
			else
			If len(FormName.txtCDDay.value) = 2 and len(FormName.txtCDMonth.value) =2  then
			call CDDay(FormName)
			end If
			end If
		end if	
	END iF
End Sub

Sub ADYear(FormName)
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid YEAR"
		
		FormName.txtAD.value = ""
	Else
		if LEN(FormName.txtADYear.value) <> 4 OR FormName.txtADYear.value = "0000" THEN
			MSGBOX "Invalid YEAR"
			
			FormName.txtAD.value = ""
		else
			iF IsNumeric(FormName.txtADYear.value) = False then
			MSGBOX "Invalid YEAR"
			
			FormName.txtAD.value = ""
			else
			If len(FormName.txtADDay.value) = 2 and len(FormName.txtADMonth.value) =2  then
			call ADDay(FormName)
			end If
			end If
		end if	
	END iF
End Sub

Sub BDYear(FormName)
	
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid YEAR"
		
		FormName.txtBD.value = ""
	Else
		if LEN(FormName.txtBDYear.value) <> 4 OR FormName.txtBDYear.value = "0000" THEN
			MSGBOX "Invalid YEAR"
			
			FormName.txtBD.value = ""
		else
			iF IsNumeric(FormName.txtBDYear.value) = False then
			MSGBOX "Invalid YEAR"
			
			FormName.txtBD.value = ""
			end If
		If len(FormName.txtBDDay.value) = 2 and len(FormName.txtBDMonth.value) =2  then
		call BDDay(FormName)
		end If
		end if
	END iF
End Sub



'**************************************'
'  Commencing Date Validation on change'
'**************************************'

Sub CDMonth(FormName)
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid MONTH"
		
		FormName.txtCD.value=""
	Else
		if LEN(FormName.txtCDMonth.value) <> 2 OR FormName.txtCDMonth.value >12 THEN
			MSGBOX "Invalid MONTH"
			
			FormName.txtCD.value=""
		ELSE 
			iF IsNumeric(FormName.txtCDMonth.value) = False then
				MSGBOX "Invalid YEAR"
				
				FormName.txtCD.value=""
			end If
			If len(FormName.txtCDDay.value) = 2 and len(FormName.txtCDYear.value) =4  then
				call CDDay(FormName)
			end If
		END iF
	End If
End Sub

Sub ADMonth(FormName)
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid MONTH"
		
		FormName.txtAD.value=""
	Else
		if LEN(FormName.txtADMonth.value) <> 2 OR FormName.txtADMonth.value >12 THEN
			MSGBOX "Invalid MONTH"
			
			FormName.txtAD.value=""
		ELSE 
			iF IsNumeric(FormName.txtADMonth.value) = False then
				MSGBOX "Invalid YEAR"
				
				FormName.txtAD.value=""
			end If
			If len(FormName.txtADDay.value) = 2 and len(FormName.txtADYear.value) =4  then
				call ADDay(FormName)
			end If
		END iF
	End If
End Sub

Sub BDMonth(FormName)
	on error resume next
	Err.Clear
	If Err.number <> 0 then
		MSGBOX "Invalid MONTH"
		
		FormName.txtBD.value=""
	Else
		if LEN(FormName.txtBDMonth.value) <> 2 OR FormName.txtBDMonth.value >12 THEN
			MSGBOX "Invalid MONTH"
			
			FormName.txtBD.value=""
		ELSE 
			iF IsNumeric(FormName.txtBDMonth.value) = False then
				MSGBOX "Invalid MONTH"
				
				FormName.txtBD.value=""
			end If
		END iF
		If len(FormName.txtBDDay.value) = 2 and len(FormName.txtBDYear.value) =4  then
			call BDDay(FormName)
		end If
	
	End If
End Sub

'**************************************'
'  FUNCTION FOR MONTH  LONG DATE	   '
'			FORM B ,C A& D & Directive '
'**************************************'

Public Function GetMonth(THEMONTH)
		Select Case THEMONTH
		Case 01 GetMonth = "Jan"
		Case 02 GetMonth = "Feb"
		Case 03 GetMonth = "Mar"
		Case 04 GetMonth = "Apr"
		Case 05 GetMonth = "May"
		Case 06 GetMonth = "Jun"
		Case 07 GetMonth = "Jul"
		Case 08 GetMonth = "Aug"
		Case 09	GetMonth = "Sep"
		Case 10 GetMonth = "Oct"
		Case 11 GetMonth = "Nov"
		Case 12 GetMonth = "Dec"
		Case else GetMonth = "NotValid"
		end Select
end Function

'**************************************'
'  Transfer Of funds  Lst YN Drop Down '
'			FORM B ,C A&D 			   '
'**************************************'

Private Function GetTaxYear(ByVal sMonth, ByVal sYear)
	Dim nTaxYear
	
	Select Case UCase(sMonth)
		Case "JAN"
			nTaxYear = CLng(sYear)
		Case "FEB"
			nTaxYear = CLng(sYear)
		Case Else
			nTaxYear = Clng(sYear) + 1
	end Select
	
	GetTaxYear = nTaxYear
End Function ' GetTaxYear


Sub GLS(FormName)
	If mid(FormName.txtGLS.value,1,1) <> "R" then
		If isnumeric(mid(FormName.txtGLS.value,1,1)) then
		FormName.txtGLS.value = "R" & FORMATNumber(FormName.txtGLS.value,2)
		ELSE
		FormName.txtGLS.value = ""
		END iF
	end if
End Sub



Sub AT(FormName)
Dim valid
	If mid(FormName.txtAT.value,1,1) <> "R" then
		If isnumeric(mid(FormName.txtAT.value,1,1)) then
		FormName.txtAT.value = "R" & FORMATNumber(FormName.txtAT.value,2)
		ELSE
		FormName.txtAT.value=""
		END iF
	end if
End Sub



Sub TPAS(FormName)
	If mid(FormName.txtTPAS.value,1,1) <> "R" then
		If isnumeric(mid(FormName.txtTPAS.value,1,1)) then
			FormName.txtTPAS.value = "R" & FORMATNumber(FormName.txtTPAS.value,2)
		ELSE
		FormName.txtTPAS.value=""
		END iF
	end if
End Sub


Sub lstYNChange(FormName)
	Dim SelValue
	SelValue="Y"
	FormName.YN.value=FormName.lstYN.selectedIndex
	if FormName.lstYN.value = SelValue then
		
		If FormName.fund.value <> "no" then
		GetXferRsn()
		else
		end If	
		FormName.txtNF.disabled = false
		FormName.txtFN.disabled = false
		FormName.txtAT.disabled= false
		FormName.lstFTTrans.disabled = false
		FormName.xferNumber.disabled = false
	else
		FormName.txtNF.disabled = True
		FormName.txtFN.disabled = True
		FormName.txtAT.disabled= True
		FormName.lstFTTrans.disabled = True
		FormName.xferNumber.disabled = True
		
	end if
end Sub

	SUB ExistingFund(FormName)
		
		lblNewFund.outerHTML = ""
		'FormName.chkNewFund.OUTERHTML="" 'CLEAR CHECK BOX'
		FormName.txtPost1.disabled = true
		FormName.txtPost2.disabled = true
		FormName.txtPost3.disabled = true
		FormName.txtPost4.disabled = true
		FormName.txtPostCode.disabled = true
		FormName.txtCP.disabled = true
		FormName.txtTelCode.disabled = true
		FormName.txtTelNumber.disabled = true
		FormName.txtFundName.DISABLED =TRUE
		FormName.lstFT.outerHTML = "<SELECT id=lstFT name=lstFT style=HEIGHT:23px;WIDTH:270px LANGUAGE=vbscript><option>" & FORMNAME.EXIST_FTYPE.VALUE & "</OPTION></SELECT>"
		FormName.lstFT.disabled=TRUE
		FormName.lstFTRsn.outerHTML= "<SELECT id=lstFTRsn name=lstFTRsn style=HEIGHT:23px;WIDTH:270px LANGUAGE=vbscript><option>" & FORMNAME.EXIST_FRSN.VALUE & "</option></SELECT>"
		FormName.lstFTRsn.disabled=true
		end Sub
	
	Sub lstYNClick(FormName)
	Dim SelValue
	SelValue="Y"
'	FORMNAME.XferTypeIn.value = FORMNAME.lstFTTRans.selectedIndex
	FormName.YN.value=FormName.lstYN.selectedIndex
	if FormName.lstYN.value = SelValue then
	GetXferRsnNew()
		If FormName.fund.value <> "no" then
		GetXferRsn()
		else 
		GetXferRsnNew()
		end If	
		
		FormName.txtNF.disabled = false
		FormName.txtFN.disabled = false
		FormName.txtAT.disabled= false
		FormName.lstFTTrans.disabled = false
		FormName.xferNumber.disabled = false
	else
		FormName.txtNF.disabled = True
		FormName.txtNF.VALUE = ""
		FormName.txtFN.disabled = True
		FormName.txtFN.disabled = True
		FormName.txtAT.VALUE= ""
		FormName.lstFTTrans.disabled = True
		FormName.xferNumber.disabled = True
		FormName.xferNumber.VALUE=""
	end if
End Sub

sub GLSClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 65 and x < 122) or x = 32 or x = 39  then
		msgbox "Please Enter only Numbers"
		
		FormName.txtGLS.focus
		FormName.txtGLS.value=""
	end If
end Sub


sub TPASClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 65 and x < 122) or x = 32 or x = 39  then
	msgbox "Please Enter only Numbers"
	
	FormName.txtTPAS.focus
	FormName.txtTPAS.value=""
	end If
end Sub

sub TRAClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 65 and x < 122) or x = 32 or x = 39 then
	msgbox "Please Enter only Numbers"
	FormName.txtTRA.focus
	
	FormName.txtTRA.value=""
	end If
end Sub

sub OTCClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 65 and x < 122) or x = 32 or x = 39 then
	msgbox "Please Enter only Numbers"
	FormName.txtOTC.focus
	
	FormName.txtOTC.value=""
	end If
end Sub

sub txtOtherIdClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	frmDirective.txtOtherId.focus
	frmDirective.txtOtherId.value=""
	frmDirective.focusset.value="OtherIdSet"
	end If
end Sub

sub txtOtherId_onfocus
	If frmDirective.focusset.value = "setRsaId" then
		frmDirective.txtRSAId.focus
		frmDirective.focusset.value = ""
	end If
	If frmDirective.focusset.value = "OtherIdSet" then
		frmDirective.txtOtherId.focus
		frmDirective.txtOtherId.value=""
		frmDirective.focusset.value = ""
	end If
	
end Sub

sub BDDayClear
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtBDDay.VALUE=""
		frmDirective.txtBDDay.outerHTML ="<input id=txtBDDay name=txtBDDay maxlength=2 style=HEIGHT:23px style=WIDTH:25px type=text onchange=BDDay(frmDirective) onkeypress=BDDayClear() tabindex=13 value=<%=session("BDDay")%>>"
		frmDirective.txtBDDay.VALUE=""
		frmDirective.txtBDDay.focus
	end If
end Sub

'**************************************
'	Set the Clear Values for Mistapes *
'**************************************

sub RSAClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtRSAId.value=""
		frmDirective.txtRSAId.outerHTML ="<input type=text id=txtRSAId name=txtRSAId  maxlength=13 onkeypress=RSAClear() tabindex=6 value=<%=session("txtRSAId")%>>"
		frmDirective.txtRSAId.value=""
		frmDirective.txtRSAId.focus
	end If
end Sub

sub ITNClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32  or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtITN.value=""
		frmDirective.txtITN.outerHTML ="<input type=text id=txtITN name=txtITN onkeypress=ITNClear maxlength=10 style=width:155px; LANGUAGE=VBSCRIPT tabindex=3 value=<%=session("txtITN")%>>"
		frmDirective.txtITN.value=""
		frmDirective.txtITN.focus
	end If
end Sub

sub FundNumberClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtFundNumber.value=""
		frmDirective.txtFundNumber.outerHTML ="<input type=text id=txtFundNumber name=txtFundNumber  maxlength=11 onkeypress=FundNumberClear() tabindex=26 value=<%=session("FundNumber")%>>"
		frmDirective.txtFundNumber.focus
		frmDirective.txtFundNumber.value=""
	end If
end Sub

sub BDYearClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtBDYear.value=""
		frmDirective.txtBDYear.outerHTML ="<input type=text id=txtBDYear name=txtBDYear style=HEIGHT:23px maxlength=4 Style=WIDTH:50px onkeypress=BDYearClear() onchange=BDYear(frmDirective) tabindex=11 value=<%=session("BDYear")%>>"
		frmDirective.txtBDYear.focus
		frmDirective.txtBDYear.value=""
	end If
end Sub

sub BDMonthClear()
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		frmDirective.txtBDMonth.value=""
		frmDirective.txtBDMonth.outerHTML ="<input id=txtBDMonth name=txtBDMonth style=HEIGHT:23px maxlength=2 style=WIDTH:25px type=text onchange=BDMonth(frmDirective) onkeypress=BDMonthClear() tabindex=12 value=<%=session("BDMonth")%> >"
		frmDirective.txtBDMonth.focus
		frmDirective.txtBDMonth.value=""
	end If
end Sub

sub SurClear()
	x = window.event.keyCode  
	' Check for ',' or apostrophe
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtSur.focus
		frmDirective.txtSur.value=""
		frmDirective.focusset.value="SurSet"
	
	end If
end Sub

sub NameClear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtName.focus
		frmDirective.txtName.value=""
		frmDirective.focusset.value="NameSet"
	end If
end Sub

sub InitClear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x=32 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtInit.value=""
		frmDirective.txtInit.outerHTML ="<input type=text id=txtInit name=txtInit maxlength=5 style=HEIGHT:22px style=WIDTH:110px LANGUAGE=vbscript tabindex=-1 onkeypress=InitClear() value=<%=session("Init")%>>"
		frmDirective.txtInit.focus
		frmDirective.txtInit.value=""
	end If
end Sub

sub Home1Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtHome1.value=""
		frmDirective.txtHome1.focus
		frmDirective.txtHome1.value=""
		frmDirective.Focusset.value="Home1Set"
	end If
end Sub

sub Home2Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtHome2.value=""
		frmDirective.txtHome2.focus
		frmDirective.txtHome2.value=""
		frmDirective.Focusset.value="Home2Set"
	end If
end Sub





sub Home3Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtHome3.value=""
		frmDirective.txtHome3.focus
		frmDirective.txtHome3.value=""
		frmDirective.Focusset.value="Home3Set"
	end If
end Sub

sub Home4Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtHome4.value=""
		frmDirective.txtHome4.focus
		frmDirective.txtHome4.value=""
		frmDirective.Focusset.value="Home4Set"
	end If
end Sub

sub HomeCodeClear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtHomeCode.value=""
		frmDirective.txtHomeCode.focus
		frmDirective.txtHomeCode.value=""
		frmDirective.Focusset.value="HomeCodeSet"
	end If
end Sub

sub Pos1Clear()
	x = window.event.keyCode  
	' Check for ',' or apostrophe
	If x=44 or x = 39 then	
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select		
		frmDirective.txtPos1.value=""
		frmDirective.txtPos1.focus
		frmDirective.txtPos1.value=""
		frmDirective.Focusset.value="Pos1Set"
	end If
end Sub

sub Pos2Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtPos2.focus
		frmDirective.txtPos2.value=""
		frmDirective.Focusset.value="Pos2Set"
	end If
end Sub

sub Pos3Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtPos3.focus
		frmDirective.txtPos3.value=""
		frmDirective.Focusset.value="Pos3Set"
	end If
end Sub

sub Pos4Clear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtPos4.focus
		frmDirective.txtPos4.value=""
		frmDirective.Focusset.value="Pos4Set"
	end If
end Sub

sub PosCodeClear()
	x = window.event.keyCode  
	' Check for ','
	If x=44 or x = 39 then
		Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
		frmDirective.txtPosCode.focus
		frmDirective.txtPosCode.value=""
		frmDirective.Focusset.value="PosCodeSet"	
	end If
end Sub

Sub txtPos1_onfocus
	If frmDirective.focusset.value = "Pos1Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtPos1.value=""
	end If
end Sub

Sub txtPos2_onfocus
	If frmDirective.focusset.value = "Pos2Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtPos2.value=""
	end If
end Sub
		
Sub txtPos3_onfocus
	If frmDirective.focusset.value = "Pos3Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtPos3.value=""
	end If
end Sub		
Sub txtPos4_onfocus
	If frmDirective.focusset.value = "Pos4Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtPos4.value=""
	end If
end Sub		
Sub txtPosCode_onfocus
	If frmDirective.focusset.value = "PosCodeSet" then
		frmDirective.focusset.value = ""
		frmDirective.txtPosCode.value=""
	end If
end Sub		

Sub txtHome2_onfocus
		If frmDirective.focusset.value = "Home2Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtHome2.value=""
	end If
end Sub

Sub txtHome3_onfocus
	If frmDirective.focusset.value = "Home3Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtHome3.value=""
	end If
end Sub		
Sub txtHome4_onfocus
	If frmDirective.focusset.value = "Home4Set" then
		frmDirective.focusset.value = ""
		frmDirective.txtHome4.value=""
	end If
end Sub		

Sub txtHomeCode_onfocus
	If frmDirective.focusset.value = "HomeCodeSet" then
		frmDirective.focusset.value = ""
		frmDirective.txtHomeCode.value=""
	end If
end Sub		
		  
Sub txtSur_onfocus
	If frmDirective.focusset.value = "SurSet" then
		frmDirective.focusset.value = ""
		frmDirective.txtSur.value=""
	end If
end Sub

Sub txtName_onfocus
	If frmDirective.focusset.value = "NameSet" then
		frmDirective.focusset.value = ""
		frmDirective.txtName.value=""
	end If
end Sub

sub OtherTaxClear()
	X = window.event.keyCode  
	If x = 44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	frmDirective.txtOtherRsn.value=""
	frmDirective.txtOtherRsn.focus
	frmDirective.focusset.value="OtherTaxSet"
	end If
end sub

sub txtOtherRsn_onfocus
	If frmDirective.focusset.value = "OtherTaxSet" then
		frmDirective.txtOtherRsn.focus
		frmDirective.txtOtherRsn.value=""
		frmDirective.focusset.value = ""
	end If
	
end Sub

sub PNClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If x = 44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPN.focus
	
	FormName.txtPN.value=""
	end If
end Sub

sub txtFN_onfocus(FormName)
	If FormName.focusset.value = "FNSet" then
		FormName.txtFN.focus
		FormName.txtFN.value=""
		FormName.focusset.value = ""
	end If
end Sub

sub FNClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
		If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
	msgbox "Please Enter only Numbers"
	FormName.txtFN.focus
	
	FormName.txtFN.value=""
	end If
end Sub


sub NFClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtNF.focus
	
	FormName.txtNF.value=""
	end If
end Sub


sub ATClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 65 and x < 122) or x = 32 or x = 39 then
	msgbox "Please Enter only Numbers"
	FormName.txtAT.focus
	
	FormName.txtAT.value=""
	end If
end Sub


sub xferNumberClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
	msgbox "Please Enter only Numbers"
	FormName.xferNumber.focus
	
	FormName.xferNumber.value=""
	end If
end Sub

sub FundNameClear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtFundName.focus
	
	FormName.txtFundName.value=""
	end If
end Sub

sub CPClear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtCP.focus
	
	FormName.txtCP.value=""
	end If
end Sub

sub TelCodeClear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
        Case "44"    msgbox "No comma's allowed"
        Case "39"	msgbox "No apostrophe's allowed"
    End Select
	FormName.txtTelCode.focus
	
	FormName.txtTelCode.value=""
	end If
end Sub

sub TelNrClear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtTelNumber.focus
	
	FormName.txtTelNumber.value=""
	end If
end Sub

sub FPost1Clear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPost1.focus
	
	FormName.txtPost1.value=""
	end If
end Sub

sub FPost2Clear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPost2.focus
	
	FormName.txtPost2.value=""
	end If
end Sub

sub FPost3Clear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPost3.focus
	
	FormName.txtPost3.value=""
	end If
end Sub

sub FPost4Clear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPost4.focus
	
	FormName.txtPost4.value=""
	end If
end Sub

sub FPostCodeClear(FormName)
	x = window.event.keyCode  
	' Check for "," '
	If x=44 or x = 39 then
	Select Case x
           Case "44"    msgbox "No comma's allowed"
           Case "39"	msgbox "No apostrophe's allowed"
        End Select
	FormName.txtPostCode.focus
	
	FormName.txtPostCode.value=""
	end If
end Sub

sub CDYearClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		FormName.txtCDYear.VALUE=""
		
		FormName.txtCDYear.focus
	end If
end Sub

sub CDMonthClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		FormName.txtCDMonth.VALUE=""
		
		FormName.txtCDMonth.focus
	end If
end Sub

sub CDDayClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		FormName.txtCDDay.VALUE=""
		
		FormName.txtCDDay.focus
	end If
end Sub

sub ADYearClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		FormName.txtADYear.VALUE=""
		
		FormName.txtADYear.focus
	end If
end Sub

sub ADMonthClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39 then
		msgbox "Please Enter only Numbers"
		FormName.txtADMonth.VALUE=""
		
		FormName.txtADMonth.focus
	end If
end Sub

sub ADDayClear(FormName)
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39  then
		msgbox "Please Enter only Numbers"
		FormName.txtADDay.VALUE=""
		
		FormName.txtADDay.focus
	end If
end Sub

sub EmplNrClear
	x = window.event.keyCode  
	' Check for 'A' to 'z'
	If (x > 58 and x < 122) or x=44 or x = 32 or x = 39  then
		msgbox "Please Enter only Numbers"
		frmDirective.txtEmplNr.VALUE=""
		frmDirective.focusset.value="EmplNrSet"
		frmDirective.txtEmplNr.focus
	end If
end Sub

sub txtEmplNr_onfocus
	If frmDirective.focusset.value = "EmplNrSet" then
		frmDirective.txtEmplNr.focus
		frmDirective.txtEmplNr.value=""
		frmDirective.focusset.value = ""
	end If
	If frmDirective.focusset.value = "FundNumberValueSet" then
		frmDirective.FundNumberValue.focus
		frmDirective.FundNumberValue.value=""
		frmDirective.focusset.value = ""
	end If

end Sub


sub txtHomeCode_onchange
	If frmDirective.txtHomeCode.value = "0" then
		msgBox "Postal Code cannot be zero"
		frmDirective.txtHomeCode.value = ""
	end If
end Sub


sub txtPosCode_onchange
	If frmDirective.txtPosCode.value = "0" then
		msgBox "Postal Code cannot be zero"
		frmDirective.txtPosCode.value = ""
	end If
end Sub

